Equivalence Classes

In this example, equivalence classes and Equivalence Classes assesslets are used. Equivalence classes are sets of values in which a system should behave identically.

Open the file Help|Examples|06 Test Methods|02 Equivalence Classes. Select View|Declaration Editor to open the Declaration Editor. The editor contains the channels cooler_voltage and engine_temperature.

COOLER_VOLTAGE equivalence classes

It is to be checked if the cooler_voltage signal values are always in the IDLE classes and if the engine_temperature signal values fall in the SAFE or DANGEROUS classes.

ENGINE_TEMPERATURE equivalence classes

Note the Risk equivalence class group was created to avoid warnings due to overlapping values. For example, the 0 value is shared between SAFE and COLD intervals.

The test cases engine temperature and cooler voltage changing and engine temperature changing and cooler voltage constant idle reflect this behavior. Using the Equivalence Classes assesslet, the following intervals are set to be mandatory and forbidden:

Equivalence classes assesslet

We set the DANGEROUS classes to be forbidden and the SAFE classes to be mandatory for the engine_temperature channel. It is to be checked if the engine temperature gets dangerously hot (between 120 and 180) or if it remains between 0 and 120.

Note that the SAFE class includes all values from cold to hot.

It is also to be checked if the cooler_voltage channel stays in IDLE class during the test execution. Select the Test Cases folder in the Project view and execute all test cases.

Equivalence classes example - build progress

The Overview report shows an Equivalence Class Coverage table, where you can see that the motor temperature was never found to be DANGEROUS and that the cooler voltage was never found to be HIGH.

Equivalence classes coverage

The test case equivalence classes and boundary values fails because the DANGEROUS class was set to be forbidden but it was found.

Temperature changes - idle changes

The test case engine temperature and cooler voltage changing succeeds because the DANGEROUS class was set to forbidden and was not found and cooler voltage is always IDLE (mandatory). The same applies to the test case engine temperature changing and cooler voltage constant idle.

Temperature changes - idle constant

Related topics